<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/common/common.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>layout 实验室后台管理 -学生</title>
  <link rel="stylesheet" href="./css/layui.css">
</head>

<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">实验室后台管理 - Layui</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="http://t.cn/RCzsdCq" class="layui-nav-img">${LoginUser} 
        </a>
        <dl class="layui-nav-child">
          <dd><a href="">基本资料</a></dd>
          <dd><a href="">安全设置</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="longin.html">退出</a></li>
    </ul>
  </div>
  <!-- 上面是顶部导航栏内容 -->
  
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item layui-nav-itemed">
          <a href="javascript:;">用户管理</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;" onclick="open_tab('<%= basePath%>/StudentAction_list','学生管理')">学生管理</a></dd> 
             <dd><a href="javascript:;" onclick="open_tab('<%= basePath%>/PlanAction_listExamine','实验室报名')">实验室报名</a></dd>
             <dd><a href="javascript:;" onclick="open_tab('<%= basePath%>/StaffAction_list','实验室报名情况')">实验室报名情况</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">日常工作管理</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;" onclick="open_tab('<%= basePath%>/WorkAction_list','工作日志')">工作日志管理</a></dd>
            <dd><a href="javascript:;" onclick="open_tab('<%= basePath%>/RepairAction_list','维修报告')">维修管理</a></dd>
          </dl>
        </li>
      </ul>
    </div>
  </div>
  
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 0px 5px 5px 5px;height: 95%">
          <div id="div_content" class="layui-tab layui-tab-brief" lay-filter="demo" style=";height: 100%" lay-allowClose="true">
            <ul class="layui-tab-title">
              <li class="layui-this" lay-allowClose="false">后台首页</li></ul>
            <div class="layui-tab-content" style="height:96%">
              <div class="layui-tab-item layui-show" style="height:100%">
                  <iframe src="<%= basePath%>/014/index.html" frameborder="0" height="100%" width="100%" id="ifrmid" name="ifrmname" ></iframe>
              </div>
            </div>
          </div>
    </div>
  </div>
  
  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © sailorj.club - 酷安@老子开发
  </div>
</div>
<script src="./js/jquery.js" type="text/javascript"></script>
<script src="./js/layui.all.js" type="text/javascript" ></script>
<script>//JavaScript代码区域
      layui.use('element',
      function() {
        var element = layui.element;
 
      });
      
	 function refreshFrame(){
		 document.getElementById('myframe').contentWindow.location.reload(true);
		}

      var index = 1;
      function open_tab(to_url,title) {
          if(hasTab(title) == 1){
            var layId = getTitle(title);
            var element = layui.element;
            element.tabChange('demo', layId);
        } else {
            title = '<cite style="font-style:normal;">'+title+'</cite>';
            var height = document.getElementById("div_content").offsetHeight - 40;
            var element = layui.element;
            element.tabAdd('demo', {
              title: title,//标题
              id: index,
              content: '<iframe class="iframe_content" width="100%" height="' + height + 'px" frameborder="0" src="' + to_url + '" id="ifrmid" name="ifrmname" ></iframe>'
            });
            element.tabChange('demo', index); //切换到 lay-id="yyy" 的这一项
            index = index + 1;
        }
      }
      window.onresize = function() {
        //动态调节iframe的高度，以div_content作为基准
        var tags = document.getElementsByClassName("iframe_content");
        for (var i = 0; i < tags.length; i++) {
          var height = document.getElementById("div_content").offsetHeight - 40;
          tags[i].style.height = height + 'px';
        }
      }
      
      //通过title获取lay-id
        function getTitle(title){
            var layId;
            $(".layui-tab-title li").each(function(){
                if($(this).find("cite").text() == title){
                    layId = $(this).attr("lay-id");
                }
            })
            return layId;
        }
        //通过title判断tab是否存在
        function hasTab(title){
            var tabIndex = -1;
            $(".layui-tab-title li").each(function(){
                if($(this).find("cite").text() == title){
                    tabIndex = 1;
                }
            })
            return tabIndex;
        }
    </script>
</body>
</html>